package cn.ym.aircraft;

import javax.swing.*;
import java.awt.image.BufferedImage;

public class Bullet extends FlyingObject {

    Bullet(int x, int y) {
        super(8, 20, 5, x, y);
    }


    public void step() {
        this.y -= this.speed;
    }

    @Override
    public BufferedImage getImage() {
        if (this.isLive()) {
            return Images.bullet;
        } else if (this.isDead()) {
            state = REMOVE;
        }
        return null;

    }

    /**
     * 重写子弹越界
     * @return boolean
     */
    public boolean isOutOfBound() {
        return this.y < -this.height;
    }
}
